function [ flag ] = is_dag( graph )
%IS_DAG Summary of this function goes here
%   Detailed explanation goes here

num_class = size(graph, 1);
tmp_graph = graph;
order = zeros(1, num_class);
selected=[];
for i = 1:num_class
    b = (sum(tmp_graph) == 0);
    idx = find(b);
    idx = setdiff(idx, selected);
    if(isempty(idx))
        flag = false;
        return
    else
        idx = idx(1);
        order(1, idx) = i;
    end
    tmp_graph(idx, :) = 0;
    selected = [selected, idx];
end

flag = true;

end

